package com.example.star.service;

import com.example.star.entity.Message;
import com.example.star.mapper.MessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageService {
    @Autowired
    private MessageMapper messageMapper;

    public void saveMessage(Message message) {
        messageMapper.insertMessage(message);
    }

    public List<Message> getMessagesByStarName(String starName) {
        return messageMapper.getMessagesByStarName(starName);
    }

    public List<Message> getAllMessagesByStarName(String starName) {
        return messageMapper.getAllMessagesByStarName(starName);
    }

    public List<Message> getUserMessages(String userName) {
        return messageMapper.getuserNames(userName);
    }
}